package com.xmall.controller.admin;


import com.xmall.bean.vo.BaseRespVo;
import com.xmall.bean.table.*;

import com.xmall.bean.vo.ListDataVo;
import com.xmall.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("admin")
//用户模块
public class UserController {

    @Autowired
    UserService userService;

    @RequestMapping("user/list")
    public BaseRespVo queryUserList(Integer page, Integer limit, String username,
                                    String mobile, String  sort, String order){
        //校验
        ListDataVo<User> userListDataVo =
                userService.queryUserList(page, limit, username, mobile, sort, order);

        return BaseRespVo.ok(userListDataVo);

    }


    @RequestMapping("address/list")
    public BaseRespVo queryAddressList(Integer page, Integer limit, String name,
                                       Integer userId, String  sort, String order){
        //查询返回addressListDataVo
        ListDataVo<Address> addressListDataVo =
                userService.queryAddressList(page, limit, name, userId, sort, order);
        return BaseRespVo.ok(addressListDataVo);
    }


    //会员收藏
    @RequestMapping("collect/list")
    public BaseRespVo queryCollectList(Integer page, Integer limit, Integer userId,
                                       Integer valueId, String  sort, String order){
        //查询返回collectsListDataVo
        ListDataVo<Collect> collectListDataVo =
                userService.queryCollectList(page, limit, userId, valueId, sort, order);
        return BaseRespVo.ok(collectListDataVo);
    }

    //会员足迹
    @RequestMapping("footprint/list")
    public BaseRespVo queryFootprintList(Integer page, Integer limit, Integer userId,
                                       Integer goodsId, String  sort, String order){
        //查询返回collectsListDataVo
        ListDataVo<Footprint> footprintListDataVo =
                userService.queryFootprintList(page, limit, userId, goodsId, sort, order);
        return BaseRespVo.ok(footprintListDataVo);
    }

    //搜索历史
    @RequestMapping("history/list")
    public BaseRespVo queryHistoryList(Integer page, Integer limit, Integer userId,
                                       String keyword, String  sort, String order){

        ListDataVo<SearchHistory> historyListDataVo = userService.queryHistoryList(page, limit, userId, keyword, sort, order);
        return BaseRespVo.ok(historyListDataVo);

    }

    @RequestMapping("feedback/list")
    public BaseRespVo queryFeedbackList(Integer page, Integer limit, String username,
                                        String sort, String order, Integer id){
        ListDataVo<Feedback> feedbackListDataVo =
                userService.queryFeedbackList(page, limit, username, sort, order, id);
        return BaseRespVo.ok(feedbackListDataVo);
    }


}




